{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/hyb_o2o/template/public/ygcss.css">
<style type="text/css">
    .yg5_key>div{float: left;line-height: 34px;}

    .store_td1{height: 45px;}

    .store_list_img{width: 60px;height: 60px;}

    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;text-align: center;}

    .yg5_tr2>td{padding: 15px;border: 1px solid #e5e5e5;}

    .yg5_tr1>td{

        border: 1px solid #e5e5e5;
        background-color: #FAFAFA;
        padding: 8px;
        font-weight: bold;

    }

    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
    .check_img{width: 45px;height: 45px;}
    .ygrow{margin-top: 20px;}
    .yghuise{background-color: grey;color: white;}
    .yghuise:hover{background-color: grey;color: white;}
</style>
<!-- <span style="color: red; font-size: 24px;">提示:如果基本设置选择为不开启多城市请添加一个城市一级名称[名称为基本设置中小程序默认城市]</span><br> -->
<span style="color: red; font-size: 24px;">注:城市一级名称和二级名称请填写完整[例如：太原市]</span>
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li {if $op == 'display'} class="active" {/if}><a href="{php echo $this->createWebUrl('city',array('op'=>'display'))}">城市一级</a></li>
    <li {if $op == 'post'} class="active" {/if}><a href="{php echo $this->createWebUrl('city',array('op'=>'post'))}">添加城市一级</a></li>
    <li {if $op == 'displays'} class="active" {/if}><a href="{php echo $this->createWebUrl('city',array('op'=>'displays'))}">城市二级</a></li>
    <li {if $op == 'posts'} class="active" {/if}><a href="{php echo $this->createWebUrl('city',array('op'=>'posts'))}">添加城市二级</a></li>
    <li {if $op == 'add'} class="active" {/if}><a href="{php echo $this->createWebUrl('city',array('op'=>'add'))}">数据导入</a></li>
</ul>

{if $op =="display"}
<div class="panel panel-default" style="margin-top: 20px;">
    <div class="panel-heading"></div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr2">
                        <td>排序</td>
                        <td>城市一级名称</td>
                        <td>是否推荐</td>
                        <td>操作</td>
                    </tr>
                    {loop $list $item}
                    <tr class="yg5_tr2">
                        <td>
                            {$item['id']}
                        </td>
                        <td>
                            {$item['name']}
                        </td>
                        <td>
                            {if $item['tuijian']=="1"}
                            <a href="{php echo $this->createWeburl('city', array('id' => $item['id'],'tuijian'=>'0','typs'=>'yiji', 'op' =>'zhuang'))}" class="storespan btn btn-xs">
                                <span style="color: red">是</span>
                                <span class="bianji" >点击不推荐
                                    <span class="arrowdown"></span>
                                </span>
                            </a>
                            {else}
                            <a href="{php echo $this->createWeburl('city', array('id' => $item['id'],'tuijian'=>'1','typs'=>'yiji', 'op' =>'zhuang'))}" class="storespan btn btn-xs">
                                <span style="color: red">否</span>
                                <span class="bianji">点击推荐
                                    <span class="arrowdown"></span>
                                </span>
                            </a>
                            {/if}
                        </td>
                        <td>
                            <a href="{php echo $this->createWeburl('city', array('id' => $item['id'], 'op' =>'post'))}"  class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">编辑
                                    <span class="arrowdown"></span>
                                </span>
                            </a>
                            <a href="{php echo $this->createWeburl('city', array('id' => $item['id'],'typs'=>'yiji', 'op' => 'delete'))}" class="storespan btn btn-xs">
                                <span class="fa fa-trash-o"></span>
                                <span class="bianji">删除
                                    <span class="arrowdown"></span>
                                </span>
                            </a>
                        </td>
                    </tr>
                    {/loop}
                </table>
            </div>
        </div>
    </div>
</div>
<div class="text-right we7-margin-top">
     {$pager}
</div>
{/if}
{if $op == "post"}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default ygdefault">
            <div class="panel-heading wyheader">
                添加城市一级
            </div>
            <div class="form-group" style="margin-top: 20px;">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">城市一级名称</label>
                <div class="col-sm-9">
                    <input type="text" name="name" value="{$items['name']}" class="form-control"  />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">是否推荐</label>
                <div class="col-sm-9">
                    <input type="radio" name="tuijian"  value="1" {if $items['tuijian'] == '1'} checked {/if} />是
                    <input type="radio" name="tuijian"  value="0" {if $items['tuijian'] == '0'} checked {/if} />否
                </div>
            </div>
        <div class="form-group" style="margin-top: 20px;">
            <input type="submit" name="submit" value="提交" class="btn col-lg-3" style="color: white;background-color: #44ABF7;"/>
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{/if}
{if $op == "displays"}
<div class="panel panel-default" style="margin-top: 20px;">
    <div class="panel-heading"></div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr2">
                        <td>排序</td>
                        <td>城市二级名称</td>
                        <td>所属城市一级</td>
                        <td>操作</td>
                    </tr>
                    {loop $list $item}
                    <tr class="yg5_tr2">
                        <td>
                            {$item['id']}
                        </td>
                        <td>
                            {$item['name']}
                        </td>
                        <td>
                            {$item['parent']['name']}
                        </td>
                        <td>
                            <a href="{php echo $this->createWeburl('city', array('id' => $item['id'], 'op' =>'posts'))}"   class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">编辑
                                    <span class="arrowdown"></span>
                                </span>
                            </a>
                            <a href="{php echo $this->createWeburl('city', array('id' => $item['id'],'typs'=>'erji', 'op' => 'delete'))}" class="storespan btn btn-xs">
                                <span class="fa fa-trash-o"></span>
                                <span class="bianji">删除
                                    <span class="arrowdown"></span>
                                </span>
                            </a>
                        </td>
                    </tr>
                    {/loop}
                    <!-- <tr>
                        <td>{$pager}</td>
                    </tr> -->
                </table>
            </div>
        </div>
    </div>
</div>
<div class="text-right we7-margin-top">
     {$pager}
</div>
{/if}
{if $op == "posts"}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default ygdefault">
            <div class="panel-heading wyheader">
                添加城市二级
            </div>
            <div class="form-group" style="margin-top: 20px;">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">城市二级名称</label>
                <div class="col-sm-9">
                    <input type="text" name="name" value="{$items['name']}" class="form-control"  />
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">所属城市一级</label>
                <div class="col-sm-9">
                    <select name="parentid" class="form-control">
                        <option value="">--请选择--</option>
                        {loop $parent $item}
                            <option value="{$item['id']}" {if $item['id']==$items['parentid']}selected{/if} >{$item['name']}</option>
                        {/loop}
                    </select>
                </div>
            </div>
        <div class="form-group" style="margin-top: 20px;">
            <input type="submit" name="submit" value="提交" class="btn col-lg-3" style="color: white;background-color: #44ABF7;"/>
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{/if}
{if $op == "add"}
<div class="main">
    <div class="panel panel-default">
    <div class="panel-heading" style="margin-bottom: 10px;">
        <h3 class="panel-title" style="margin-left: 20px;">
            全国市县区数据导入<p style="color: red">请到服务器模块目录中下载上传 [hyb_o2o/resource/city/shuju.xlsx]</p>
        </h3>
    </div>
    <form id="importform" class="form-horizontal form" action="" method="post" enctype="multipart/form-data" style="margin-left: 30px;">
        <div class="form-group">
            <div class="col-sm-5 goodsname"  style="padding-right:0; " >
                <input type="file" name="file" class="form-control" style="height: 38px;" />
            </div>
        </div>
        
        <div class='form-group'>
            <div class="col-sm-12">
                <div class="modal-footer" style="text-align: left">
                <input name="token" type="hidden" value="{$_W['token']}" />
                <input type="submit" class="btn btn-primary col-lg-1" name="submit" value="确认导入" style="margin-left: 45%;" />
                </div>
            </div>
        </div>
    </form>
</div>
</div>

{/if}
<script type="text/javascript">
    $(function(){
        $("#frame-14").show();
        $("#yframe-14").addClass("wyactive");
    })
</script>
{template "common/footer"}